package com.activenetwork.smlite.testcase.login;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.annotations.Test;

import com.activenetwork.smlite.page.event.EventsHomeView;
import com.activenetwork.smlite.testcase.BaseCase;
import com.activenetwork.util.EnvContext;
import com.activenetwork.util.PageLoader;
import com.activenetwork.util.verification.gson.FailurePoint;


public class Login004 extends BaseCase {
	static final Logger logger = LoggerFactory.getLogger(Login004.class);

	
	@Test
	public void Check_username_case_sensibility(){	
		
		// Login with lower letter
		loginBusiness.login("autotest1@activenetwork.com", "st@rc!te");
		EventsHomeView eventsHomeView = PageLoader.load(EventsHomeView.class);
		eventsHomeView.logout();
		
		// Login with upper letter
		loginBusiness.login(StringUtils.upperCase("autotest1@activenetwork.com"), "st@rc!te");
		eventsHomeView = PageLoader.load(EventsHomeView.class);
		String loggedIn = eventsHomeView.getLoggeredInUser();
		if(!StringUtils.contains(loggedIn, "Logged in as:")){
			EnvContext.failurePointTL.get().add(new FailurePoint(
					Login004.class.getName(), 
					"Verify user name is insensitive", 
					"User name is sensitive.Not correct."));
		}
		
		loginBusiness.logout();
	}
}
